import Cookies from 'js-cookie'

const TokenKey = 'token'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

export function getObj(name) {
  return Cookies.get(name)
}

export function setObj(name, val) {
  // const domain = document.domain.split('.').slice(1).join('.')
  // return Cookies.set(name, val, { domain: domain })
  return Cookies.set(name, val)
}

export function removeObj(name) {
  // const domain = document.domain.split('.').slice(1).join('.')
  // return Cookies.remove(name, { domain: domain })
  return Cookies.remove(name)
}
